# Repository Overview

Welcome to this repository. This appears to be a small Java desktop application for converting currencies through a Swing-based user interface. It uses a remote exchange-rate service to look up supported currency codes and calculate conversions. The codebase is compact, which makes it approachable for a new contributor, and the main flow is easy to trace from startup through the UI and into the API helper.

## Overview

This project appears to implement a currency converter application with a graphical interface. A user can enter an amount, choose a source currency and a target currency, and request a converted result. The application also appears to support swapping the selected currencies and clearing the form.

The code structure suggests a simple layered design:

- a JVM entry point that starts the UI
- a Swing user interface that handles interaction
- an API helper that fetches currency metadata and conversion results

Because the repository is small, most of the behavior appears to live in the UI class and the API helper rather than in a large service layer.

## Technology Stack

The detected stack appears to be:

- **Java** — the primary language used across the repository
- **Swing / AWT** — used for the desktop UI
- **Gson** — used to parse JSON responses from the exchange-rate service
- **SLF4J** — used for logging
- **Standard Java networking and I/O** — used to call the external API and load configuration

No well-known application framework was detected from imports, so this looks like a plain Java desktop application rather than a Spring, JavaFX, or web-based project.

## Architecture

The architecture appears to be intentionally simple. The application starts in `CurrencyConverter`, which launches the Swing UI on the event dispatch thread. The UI then calls `CurrencyRateAPI` to fetch currency codes and conversion results. Two nested helper classes inside the UI support input validation and asynchronous loading of currency codes.

```mermaid
flowchart TD
    CurrencyConverter["CurrencyConverter"] --> UI["UI"]
    UI --> CurrencyRateAPI["CurrencyRateAPI"]
    UI --> NumericFilter["NumericFilter"]
    UI --> CurrencyCode["CurrencyCode"]
```

### How the pieces fit together

- `CurrencyConverter` is the launch point for the application.
- `UI` builds the window, form controls, and button actions.
- `CurrencyRateAPI` loads the API key, fetches supported currencies, and performs conversion requests.
- `NumericFilter` constrains the amount field so only numeric input is accepted.
- `CurrencyCode` loads currency codes in the background so the UI stays responsive.

## Module Guide

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

This module appears to contain the executable entry point for the application. The key class is `CurrencyConverter`, which only provides `main(String[] args)` and delegates startup to the Swing UI. Its role is bootstrap-only, so it does not appear to contain any business logic.

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

This module appears to contain the main desktop interface. The central class is `UI`, which extends `JFrame` and assembles the amount field, currency selectors, result label, and action buttons. It also contains two nested helper classes:

- `NumericFilter` — validates text input in the amount field so the user can only enter numeric values and a single decimal point
- `CurrencyCode` — a `SwingWorker` that loads currency codes in the background and populates the combo boxes

The UI class also appears to handle button actions for conversion, swapping currencies, and clearing the form, so this module is the heart of the user experience.

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

This module appears to wrap the external exchange-rate service. The key class is `CurrencyRateAPI`, which loads an API key from `config.properties`, builds request URLs, and performs HTTP GET calls. It exposes methods to retrieve supported currency codes and to convert between two currencies. This module is the main integration point with the remote API.

## Getting Started

A new developer should probably start with the following files and reading order:

1. **`src/main/java/com/github/blaxk3/converter/CurrencyConverter.java`**  
   This is the application entry point and shows how the program starts.

2. **`src/main/java/com/github/blaxk3/ui/UI.java`**  
   This is the main behavior hub. It shows how the window is built, how user actions are wired, and how the API helper is used.

3. **`src/main/java/com/github/blaxk3/api/CurrencyRateAPI.java`**  
   This explains how the application talks to the external exchange-rate API and where configuration is loaded from.

4. **Nested helpers inside `UI.java`**  
   Read `NumericFilter` and `CurrencyCode` after the main UI flow, since they support validation and background loading.

### Suggested mental model

- Start at `main`.
- Follow the UI construction.
- Trace the Convert button action into `CurrencyRateAPI.convert(...)`.
- Trace the combo box loading path into `CurrencyRateAPI.getCurrencyCode()`.
- Check `config.properties` handling if API access does not work as expected.

### Useful entry points for debugging

- **Startup issues** — `CurrencyConverter.main(...)`
- **Window layout or button behavior** — `UI`
- **Invalid or missing currency data** — `CurrencyRateAPI.getCurrencyCode()`
- **Conversion failures** — `CurrencyRateAPI.convert(...)`
- **Input validation problems** — `NumericFilter`

If you are new to this codebase, the UI class is likely the best place to begin because it ties together the rest of the application.