# t3rius/t3_winemakerjob architecture

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

- Interactive diagram: https://gitdiagram.com/t3rius/t3_winemakerjob
- Repository: https://github.com/t3rius/t3_winemakerjob

## Overview

##### Main Components
- Client Component: Represented by the code in the "client" folder (client/main.lua). This part handles in-game UI and interactions, such as displaying menus (boss menu), handling user inputs, and managing local game events.
- Server Component: Shown as the "server" folder (server/main.lua). It processes the core logic such as validating job actions, synchronizing state, handling business logic (harvesting, wine production steps), and communicating with the client.
- Configuration & Manifests: Include the shared configuration file ("config.lua") and the resource manifest ("fxmanifest.lua"). These files set up how the mod is loaded by the game runtime and provide key settings needed by both the client and server.
- Locales: The "locales" folder contains several language files (cs.lua, en.lua, et.lua). This represents the internationalization (i18n) layer to adapt in-game texts for various languages.
- Database/SQL: Include the "t3_winemakerjob.sql" file which likely sets up database schema or data required for tracking job progress, inventory items, and persistence of records.
- External Dependencies: Explicitly note external libraries (ox_lib and ox_target) as supporting components, which provide additional functionalities like target interactions and utility methods.

##### Relationships and Data Flows
- Directional Communication:

##### Important Architectural Patterns
- Separation of Concerns: The clear split between client-side and server-side logic improves modularity.
- Configurable and Internationalized Design: The presence of a central configuration file and dedicated locales support an adaptable system.
- External Integration: The use of external modules (ox_lib, ox_target) indicates a plugin-friendly design.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Subgraph: Configuration & Internationalization
    subgraph "Configuration & Internationalization"
        CONF("Configuration (config.lua)"):::config
        MAN("Manifest (fxmanifest.lua)"):::config
        LOC("Locales (locales/)"):::config
    end

    %% Subgraph: External Libraries
    subgraph "External Libraries"
        EX1("ox_lib"):::external
        EX2("ox_target"):::external
    end

    %% Subgraph: Server Side
    subgraph "Server Side"
        S1("Server Module (server/main.lua)"):::server
        S2("Business Logic (Job Actions, Harvesting)"):::server
    end

    %% Subgraph: Client Side
    subgraph "Client Side"
        C1("Client Module (client/main.lua)"):::client
        C2("UI/Interaction (Boss Menu, Garage)"):::client
    end

    %% Subgraph: Persistence
    subgraph "Persistence"
        DB("Database (t3_winemakerjob.sql)"):::database
    end

    %% Relationships between Client and Server
    C1 -->|"JobActionCommands"| S1
    S1 -->|"StateUpdates"| C1

    %% Relationship: Server to Database
    S1 -->|"DataPersistence"| DB

    %% Relationships: Configuration & Internationalization to Client and Server
    CONF -->|"init"| C1
    CONF -->|"init"| S1
    MAN -->|"init"| C1
    MAN -->|"init"| S1
    LOC -->|"init"| C1
    LOC -->|"init"| S1

    %% Relationships: External Libraries with Client and Server
    C1 -->|"UIUtilities"| EX1
    C1 -->|"TargetInteractions"| EX2
    S1 -->|"UtilityMethods"| EX1
    S1 -->|"TargetInteractions"| EX2

    %% Intra-Client relationship for UI flow
    C1 -->|"manages"| C2

    %% Click Events
    click C1 "https://github.com/t3rius/t3_winemakerjob/blob/main/client/main.lua"
    click S1 "https://github.com/t3rius/t3_winemakerjob/blob/main/server/main.lua"
    click CONF "https://github.com/t3rius/t3_winemakerjob/blob/main/config.lua"
    click MAN "https://github.com/t3rius/t3_winemakerjob/blob/main/fxmanifest.lua"
    click LOC "https://github.com/t3rius/t3_winemakerjob/tree/main/locales/"
    click DB "https://github.com/t3rius/t3_winemakerjob/blob/main/t3_winemakerjob.sql"

    %% Styles
    classDef client fill:#a8d5e2,stroke:#333,stroke-width:2px;
    classDef server fill:#f5b7b1,stroke:#333,stroke-width:2px;
    classDef config fill:#d7bde2,stroke:#333,stroke-width:2px;
    classDef database fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef external fill:#aed6f1,stroke:#333,stroke-width:2px;
```
