# Repository Overview

Welcome to this repository. This appears to be a small Java desktop application for converting currencies, with a Swing-based user interface, a lightweight startup class, and a service layer that talks to the ExchangeRate-API. The code is organized into a few focused packages rather than a large framework-driven application, which should make it approachable for a new contributor. The detected stack suggests plain Java with Swing, HTTP networking, Gson for JSON parsing, and SLF4J for logging.

## Overview

This repository appears to implement a currency converter that lets a user enter an amount, choose two currencies, and fetch a live exchange result from an external API. The application is split into three main areas: startup, UI, and API integration. That separation keeps the launch path simple while letting the UI focus on user interaction and the API layer focus on remote data access.

The main workflow seems to be:

1. Start the application from the converter entry point.
2. Show a Swing window with amount input and currency selectors.
3. Load supported currency codes from the external service.
4. Request a conversion result when the user clicks Convert.

## Technology Stack

This repository appears to use the following technologies and libraries:

- **Java** — the application language.
- **Swing / AWT** — used for the desktop UI.
- **`javax.swing.SwingWorker`** — used to load currency codes in the background.
- **`SwingUtilities.invokeLater`** — used to create the UI on the Event Dispatch Thread.
- **HTTP networking (`HttpURLConnection`)** — used for calling the external rate service.
- **Gson** — used to parse JSON responses.
- **SLF4J** — used for logging errors and failures.
- **ExchangeRate-API** — the external service used for currency codes and conversion values.

No well-known application framework was detected from the indexed imports, so this appears to be a straightforward Java desktop program.

## Architecture

The architecture appears to be a small layered design:

- **`com.github.blaxk3.converter`** starts the application.
- **`com.github.blaxk3.ui`** owns the Swing window and user interactions.
- **`com.github.blaxk3.api`** handles remote currency lookups and conversions.

The UI depends on the API layer for data, while the entry point depends on the UI to launch the app.

```mermaid
flowchart TD
OverviewModule["Repository Overview"] --> ConverterModule["com.github.blaxk3.converter"]
OverviewModule --> UIModule["com.github.blaxk3.ui"]
OverviewModule --> ApiModule["com.github.blaxk3.api"]
ConverterModule --> UIModule
UIModule --> ApiModule
```

## Module Guide

### `com.github.blaxk3.converter`

This appears to be the application entry-point package. It contains `CurrencyConverter`, which provides the `main` method and starts the UI on the Swing Event Dispatch Thread. If you are trying to understand how the application launches, this is the first module to read.

### `com.github.blaxk3.ui`

This appears to contain the main Swing user interface. The key class is `UI`, which builds the window, validates amount input, loads currency codes in the background, and wires up the Convert, Swap, and Clear actions. It also contains nested helper classes that support input filtering and asynchronous loading.

### `com.github.blaxk3.api`

This appears to be the external service integration layer. The key class is `CurrencyRateAPI`, which reads the API key from configuration, calls the ExchangeRate-API service, parses JSON responses, and exposes methods for listing supported currency codes and converting an amount between currencies.

## Getting Started

If you are new to the codebase, a good reading order is:

1. **`src/main/java/com/github/blaxk3/converter/CurrencyConverter.java`** — shows how the application starts.
2. **`src/main/java/com/github/blaxk3/ui/UI.java`** — shows the main window, user actions, and background loading flow.
3. **`src/main/java/com/github/blaxk3/api/CurrencyRateAPI.java`** — shows how remote currency data is fetched and parsed.

A helpful mental model is to follow the data flow from user action to API call and back to the UI. Start at `CurrencyConverter.main`, trace into `UI`, then follow `CurrencyRateAPI` to see where currency codes and conversion values come from.

### Suggested entry points

- `CurrencyConverter.main(String[] args)` — application startup.
- `UI` constructor — builds and displays the window.
- `CurrencyRateAPI.getCurrencyCode()` — loads available currency codes.
- `CurrencyRateAPI.convert(...)` — performs the exchange calculation.

### What to inspect next

- How `config.properties` is packaged so the API key is available at runtime.
- How the UI handles errors when the remote service is unavailable.
- Whether the current single-class service layer should eventually be split into smaller configuration and transport helpers.
