# pp-namias/car-dealership-management-program architecture

> Architecture diagram of the GitHub repository pp-namias/car-dealership-management-program, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pp-namias/car-dealership-management-program
- Repository: https://github.com/pp-namias/car-dealership-management-program

## Overview

##### Project Type and Purpose
- This is a console application developed in C++ for managing a car dealership.
- The project’s purpose includes handling authentication (login system), managing employees and cars data, processing orders, and logging order and login activities.
- Data persistence is achieved by simple text file handling rather than a full database system.

##### File Structure
- The top-level structure includes Visual Studio solution files (CarDealership.sln, project files, etc.) indicating the development environment.
- The “CarDealership” directory holds the main C++ source files (e.g., CarDealership.cpp) together with resource files like text files (e.g., Employee.txt, Cars_Name.txt, Order_Logs.txt) which serve as the persistence layer.
- There are also directories for images and build outputs (Debug/Release folders) that confirm the build and demo artifacts.

##### Extract Information from the README
- The README outlines the roles (Admin, Employee, Guest) and the features available to each.
- It provides a detailed list of functionalities from adding, editing, displaying, and deleting data to ordering cars and generating receipts.
- Programming principles such as Object-Oriented and Procedural Programming along with file handling are clearly emphasized.

a. Main Components:
- User Interface (Console-based): Handles user input and displays menus depending on the role (Admin, Employee, or Guest).
- Authentication Module: Responsible for validating user credentials and managing access control.
- Core Management Modules:
- Employee Management (adding, editing, displaying, searching, deleting employee data).
- Order Processing Module (handling order logs, car orders, receipts, and cashier operations).
- Log Management (managing login and order logs for auditing).
- Data Persistence Layer: Responsible for reading from and writing to text files (e.g., Cars_Color.txt, Employee.txt).
- Auxiliary Components: “About Us” and other informational modules.

b. Relationships and Interactions:
- The authentication module sits at the entry point, feeding into the Main Menu.
- Depending on the user’s role, the system branches into the respective module(s). For example:
- Admin: Has full access to employee management, car management, and logs.
- Employee: Has limited access, mainly order management and viewing order logs.
- Guest: Can only order cars and view “About Us”.
- All modules interact with the Data Persistence layer for CRUD operations on the text-based datasets.
- The data flow is cyclical, with user actions updating log files (for orders and logins) and vice versa.

c. Architectural Patterns/Design Principles:
- Code reusability, as similar processes (like add/edit/delete) are used across different modules.
- That procedural programming is also a factor here, given the main procedural structure of most C++ console applications.

d. Relevant Technologies, Frameworks, or Libraries:
- The project is developed entirely in C++ using Microsoft Visual Studio.
- Key libraries would include the standard C++ libraries (for file I/O and console I/O).
- The build environment (Visual Studio solution files, .vcxproj) might be mentioned as part of the development infrastructure.

##### Final Reminders
- Don’t overcomplicate it; you want to show all key components and their interdependencies without going into minute code-level details.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interface Layer"
        UI["Console-based UI"]:::ui
    end

    subgraph "Authentication & Menu"
        Auth["Authentication Module"]:::logic
        Menu["Main Menu & Role Navigation"]:::logic
    end

    subgraph "Admin Modules"
        EmpMgmt["Employee Management Module"]:::logic
        CarMgmt["Car Management Module"]:::logic
        LogMgmt["Log Management Module"]:::logic
    end

    subgraph "Employee/Guest Modules"
        OrderProc["Order Processing Module"]:::logic
        AboutUs["About Us Section"]:::ui
    end

    subgraph "Data Persistence"
        DataPersist["Data Persistence Layer"]:::persist
    end

    %% Flow Connections
    UI -->|"leadsTo"| Auth
    Auth -->|"validates"| Menu

    Menu -->|"AdminAccess"| EmpMgmt
    Menu -->|"AdminAccess"| CarMgmt
    Menu -->|"AdminAccess"| LogMgmt
    Menu -->|"EmployeeGuestAccess"| OrderProc
    Menu -->|"GuestAccess"| AboutUs

    %% Data Persistence Connections (bidirectional for CRUD operations)
    Auth <-->|"roleData"| DataPersist
    EmpMgmt <-->|"CRUD"| DataPersist
    CarMgmt <-->|"CRUD"| DataPersist
    OrderProc <-->|"CRUD"| DataPersist
    LogMgmt <-->|"CRUD"| DataPersist

    %% Click Events
    click UI "https://github.com/pp-namias/car-dealership-management-program/blob/main/CarDealership/CarDealership.cpp"
    click Auth "https://github.com/pp-namias/car-dealership-management-program/blob/main/CarDealership/CarDealership.cpp"
    click Auth "https://github.com/pp-namias/car-dealership-management-program/blob/main/CarDealership/Text Files/Admin.txt"
    click EmpMgmt "https://github.com/pp-namias/car-dealership-management-program/blob/main/CarDealership/CarDealership.cpp"
    click EmpMgmt "https://github.com/pp-namias/car-dealership-management-program/blob/main/CarDealership/Text Files/Employee.txt"
    click CarMgmt "https://github.com/pp-namias/car-dealership-management-program/blob/main/CarDealership/CarDealership.cpp"
    click CarMgmt "https://github.com/pp-namias/car-dealership-management-program/blob/main/CarDealership/Text Files/Cars_Name.txt"
    click CarMgmt "https://github.com/pp-namias/car-dealership-management-program/blob/main/CarDealership/Text Files/Cars_Color.txt"
    click CarMgmt "https://github.com/pp-namias/car-dealership-management-program/blob/main/CarDealership/Text Files/Cars_Price.txt"
    click OrderProc "https://github.com/pp-namias/car-dealership-management-program/blob/main/CarDealership/CarDealership.cpp"
    click OrderProc "https://github.com/pp-namias/car-dealership-management-program/blob/main/CarDealership/Text Files/Order_Logs.txt"
    click LogMgmt "https://github.com/pp-namias/car-dealership-management-program/blob/main/CarDealership/Text Files/Login_Logs.txt"
    click LogMgmt "https://github.com/pp-namias/car-dealership-management-program/blob/main/CarDealership/Text Files/Order_Logs.txt"
    click DataPersist "https://github.com/pp-namias/car-dealership-management-program/tree/main/CarDealership/Text Files"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef logic fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef persist fill:#FFCC99,stroke:#000,stroke-width:2px;
```
