# ariskycode/geektrust-ledger-company architecture

> Architecture diagram of the GitHub repository ariskycode/geektrust-ledger-company, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ariskycode/geektrust-ledger-company
- Repository: https://github.com/ariskycode/geektrust-ledger-company

## Overview

##### Main Components

a. Input Processing Layer
- Command Parser (handles ALLOT_WATER, ADD_GUESTS, BILL commands)
- File Input Handler (processes input files)

b. Core Domain Layer
- Apartment Management
- Apartment Types (2BHK, 3BHK)
- Water Allocation Calculator
- Guest Management
- Guest Tracker
- Additional Water Calculator
- Billing System
- Corporation Water Calculator
- Borewell Water Calculator
- Tanker Water Calculator
- Total Bill Calculator

c. Output Layer
- Bill Formatter
- Console Output Handler

##### Key Relationships to Highlight

- Input File → Command Parser → Apartment Management
- ↓
- Water Allocation
- ↓
- Guest Management
- ↓
- Billing System
- ↓
- Output Handler

##### Important Details

- Water allocation ratios
- Pricing tiers for different water types
- Guest calculation flow
- Bill calculation pipeline

##### Technical Specifications to Note
- Java-based implementation
- Command-line interface
- File-based input system
- Maven build system

##### Design Patterns to Highlight
- Command Pattern (for handling different input commands)
- Strategy Pattern (for different water pricing calculations)
- Factory Pattern (for creating appropriate apartment types)

- Any abbreviations or special symbols

This design should emphasize the separation of concerns between:
- Input processing
- Business logic
- Calculation engines
- Output formatting

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef input fill:#a8d1f0,stroke:#000
    classDef core fill:#90EE90,stroke:#000
    classDef calc fill:#FFE5B4,stroke:#000
    classDef output fill:#FFA07A,stroke:#000
    classDef file fill:#D3D3D3,stroke:#000

    %% Input Layer
    subgraph InputLayer["Input Processing Layer"]
        InputFile[("Input Files")]:::file
        CmdParser["Command Parser"]:::input
        FileHandler["File Input Handler"]:::input
    end

    %% Core Domain Layer
    subgraph CoreDomain["Core Domain Layer"]
        subgraph AptManagement["Apartment Management"]
            AptTypes["Apartment Types\n(2BHK, 3BHK)"]:::core
            WaterAlloc["Water Allocation\nCalculator"]:::core
        end

        subgraph GuestManagement["Guest Management"]
            GuestTracker["Guest Tracker"]:::core
            AddWaterCalc["Additional Water\nCalculator"]:::core
        end

        subgraph BillingSystem["Billing System"]
            CorpWater["Corporation Water\nCalculator"]:::calc
            BoreWater["Borewell Water\nCalculator"]:::calc
            TankWater["Tanker Water\nCalculator"]:::calc
            TotalBill["Total Bill\nCalculator"]:::calc
        end
    end

    %% Output Layer
    subgraph OutputLayer["Output Layer"]
        BillFormat["Bill Formatter"]:::output
        ConsoleOut["Console Output\nHandler"]:::output
    end

    %% Relationships
    InputFile --> FileHandler
    FileHandler --> CmdParser
    CmdParser --> AptTypes
    AptTypes --> WaterAlloc
    WaterAlloc --> GuestTracker
    GuestTracker --> AddWaterCalc
    AddWaterCalc --> CorpWater
    WaterAlloc --> CorpWater
    WaterAlloc --> BoreWater
    AddWaterCalc --> TankWater
    CorpWater --> TotalBill
    BoreWater --> TotalBill
    TankWater --> TotalBill
    TotalBill --> BillFormat
    BillFormat --> ConsoleOut

    %% Click events
    click InputFile "https://github.com/ariskycode/geektrust-ledger-company/blob/master/sample_input/input1.txt"
    click FileHandler "https://github.com/ariskycode/geektrust-ledger-company/blob/master/src/main/java/com/example/geektrust/Main.java"
    click CmdParser "https://github.com/ariskycode/geektrust-ledger-company/blob/master/src/main/java/com/example/geektrust/Main.java"
    click ConsoleOut "https://github.com/ariskycode/geektrust-ledger-company/blob/master/src/main/java/com/example/geektrust/Main.java"

    %% Legend with descriptions
    subgraph Legend["Component Types & Descriptions"]
        L1["Input Components - Handle raw data and command processing"]:::input
        L2["Core Components - Main business logic implementation"]:::core
        L3["Calculation Components - Handle numerical computations"]:::calc
        L4["Output Components - Format and display results"]:::output
        L5[("File Components - Store and retrieve data")]:::file
    end
```
