# abrarabir1726/gunshop architecture

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

- Interactive diagram: https://gitdiagram.com/abrarabir1726/gunshop
- Repository: https://github.com/abrarabir1726/gunshop

## Overview

Gunshop is a terminal-based Java shop management system. The runtime workflow starts at Main, presents customer or admin authentication, then enters the corresponding panel. Customers can browse guns and ammunition, create and review bookings, and calculate or generate a bill; admins can review and confirm bookings and add inventory. Services use flat files for accounts, inventory, and bookings, with Customer, Gun, and Booking providing record parsing. The excerpts show the main calls and file operations; hard-coded Windows paths do not consistently match the repository’s deta directory.

Main entry points: [`BookingService.java`](https://github.com/abrarabir1726/gunshop/blob/main/BookingService.java) (Booking and billing), [`AdminPanel.java`](https://github.com/abrarabir1726/gunshop/blob/main/AdminPanel.java) (Admin menu), [`GunService.java`](https://github.com/abrarabir1726/gunshop/blob/main/GunService.java) (Gun and ammo catalog), [`AuthService.java`](https://github.com/abrarabir1726/gunshop/blob/main/AuthService.java) (Authentication menus)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and access"]
  node_main["Application entry<br/>[Main.java]"]
  node_auth["Authentication menus<br/>[AuthService.java]"]
  node_filemanager["Account access<br/>[FileManager.java]"]
end

subgraph group_customer["Customer shopping"]
  node_customerpanel["Customer menu<br/>[CustomerPanel.java]"]
  node_gunservice["Gun and ammo catalog<br/>[GunService.java]"]
  node_bookingservice["Booking and billing"]
end

subgraph group_admin["Admin management"]
  node_adminpanel["Admin menu<br/>[AdminPanel.java]"]
end

subgraph group_records["Records and files"]
  node_customer["Customer record<br/>[Customer.java]"]
  node_gun["Gun record<br/>[Gun.java]"]
  node_booking["Booking record<br/>[Booking.java]"]
  node_customersfile[("Customer accounts<br/>[customers.txt]")]
  node_adminsfile[("Admin accounts<br/>[admins.txt]")]
  node_gunsfile[("Gun inventory<br/>[guns.txt]")]
  node_ammofile[("Ammo inventory<br/>[ammo.txt]")]
  node_bookingsfile[("Bookings<br/>[bookings.txt]")]
  node_confirmedfile[("Confirmed bookings<br/>[bookings.txt]")]
end

node_terminal(("Terminal user"))

node_terminal -->|"starts"| node_main
node_main -->|"opens menu"| node_auth
node_auth -->|"authenticates"| node_filemanager
node_auth -->|"opens customer"| node_customerpanel
node_auth -->|"opens admin"| node_adminpanel
node_filemanager -->|"parses account"| node_customer
node_filemanager -->|"reads and writes"| node_customersfile
node_filemanager -->|"reads and writes"| node_adminsfile
node_customerpanel -->|"uses account"| node_customer
node_customerpanel -->|"browses catalog"| node_gunservice
node_customerpanel -->|"manages bookings"| node_bookingservice
node_gunservice -->|"parses guns"| node_gun
node_gunservice -->|"reads inventory"| node_gunsfile
node_gunservice -->|"reads ammo"| node_ammofile
node_bookingservice -->|"uses account"| node_customer
node_bookingservice -->|"parses bookings"| node_booking
node_bookingservice -->|"loads catalog"| node_gunservice
node_bookingservice -->|"reads and appends"| node_bookingsfile
node_adminpanel -->|"reads bookings"| node_bookingsfile
node_adminpanel -->|"appends confirmations"| node_confirmedfile
node_adminpanel -->|"appends guns"| node_gunsfile
node_adminpanel -->|"appends ammo"| node_ammofile

click node_main "https://github.com/abrarabir1726/gunshop/blob/main/Main.java"
click node_auth "https://github.com/abrarabir1726/gunshop/blob/main/AuthService.java"
click node_filemanager "https://github.com/abrarabir1726/gunshop/blob/main/FileManager.java"
click node_customerpanel "https://github.com/abrarabir1726/gunshop/blob/main/CustomerPanel.java"
click node_gunservice "https://github.com/abrarabir1726/gunshop/blob/main/GunService.java"
click node_bookingservice "https://github.com/abrarabir1726/gunshop/blob/main/BookingService.java"
click node_adminpanel "https://github.com/abrarabir1726/gunshop/blob/main/AdminPanel.java"
click node_customer "https://github.com/abrarabir1726/gunshop/blob/main/Customer.java"
click node_gun "https://github.com/abrarabir1726/gunshop/blob/main/Gun.java"
click node_booking "https://github.com/abrarabir1726/gunshop/blob/main/Booking.java"
click node_customersfile "https://github.com/abrarabir1726/gunshop/blob/main/deta/customers.txt"
click node_adminsfile "https://github.com/abrarabir1726/gunshop/blob/main/deta/admins.txt"
click node_gunsfile "https://github.com/abrarabir1726/gunshop/blob/main/deta/guns.txt"
click node_ammofile "https://github.com/abrarabir1726/gunshop/blob/main/deta/ammo.txt"
click node_bookingsfile "https://github.com/abrarabir1726/gunshop/blob/main/deta/bookings.txt"
click node_confirmedfile "https://github.com/abrarabir1726/gunshop/blob/main/deta/bookings.txt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_auth,node_filemanager,node_terminal toneBlue
class node_customerpanel,node_gunservice,node_bookingservice toneAmber
class node_adminpanel toneMint
class node_customer,node_gun,node_booking,node_customersfile,node_adminsfile,node_gunsfile,node_ammofile,node_bookingsfile,node_confirmedfile toneRose
```

## Components

### Entry and access

- [Application entry](https://github.com/abrarabir1726/gunshop/blob/main/Main.java): `Main.java`
- [Authentication menus](https://github.com/abrarabir1726/gunshop/blob/main/AuthService.java): `AuthService.java`
- [Account access](https://github.com/abrarabir1726/gunshop/blob/main/FileManager.java): `FileManager.java`

### Customer shopping

- [Customer menu](https://github.com/abrarabir1726/gunshop/blob/main/CustomerPanel.java): `CustomerPanel.java`
- [Gun and ammo catalog](https://github.com/abrarabir1726/gunshop/blob/main/GunService.java): `GunService.java`
- [Booking and billing](https://github.com/abrarabir1726/gunshop/blob/main/BookingService.java): `BookingService.java`

### Admin management

- [Admin menu](https://github.com/abrarabir1726/gunshop/blob/main/AdminPanel.java): `AdminPanel.java`

### Records and files

- [Customer record](https://github.com/abrarabir1726/gunshop/blob/main/Customer.java): `Customer.java`
- [Gun record](https://github.com/abrarabir1726/gunshop/blob/main/Gun.java): `Gun.java`
- [Booking record](https://github.com/abrarabir1726/gunshop/blob/main/Booking.java): `Booking.java`
- [Customer accounts](https://github.com/abrarabir1726/gunshop/blob/main/deta/customers.txt): `deta/customers.txt`
- [Admin accounts](https://github.com/abrarabir1726/gunshop/blob/main/deta/admins.txt): `deta/admins.txt`
- [Gun inventory](https://github.com/abrarabir1726/gunshop/blob/main/deta/guns.txt): `deta/guns.txt`
- [Ammo inventory](https://github.com/abrarabir1726/gunshop/blob/main/deta/ammo.txt): `deta/ammo.txt`
- [Bookings](https://github.com/abrarabir1726/gunshop/blob/main/deta/bookings.txt): `deta/bookings.txt`
- [Confirmed bookings](https://github.com/abrarabir1726/gunshop/blob/main/deta/bookings.txt): `deta/bookings.txt`

### Other components

- **Terminal user**

## Connections

- Terminal user → Application entry: starts (evidence: `Main.java`)
- Application entry → Authentication menus: opens menu (evidence: `Main.java`)
- Authentication menus → Account access: authenticates (evidence: `AuthService.java`)
- Authentication menus → Customer menu: opens customer (evidence: `AuthService.java`)
- Authentication menus → Admin menu: opens admin (evidence: `AuthService.java`)
- Account access → Customer record: parses account (evidence: `FileManager.java`)
- Account access → Customer accounts: reads and writes (evidence: `FileManager.java`)
- Account access → Admin accounts: reads and writes (evidence: `FileManager.java`)
- Customer menu → Customer record: uses account (evidence: `CustomerPanel.java`)
- Customer menu → Gun and ammo catalog: browses catalog (evidence: `CustomerPanel.java`)
- Customer menu → Booking and billing: manages bookings (evidence: `CustomerPanel.java`)
- Gun and ammo catalog → Gun record: parses guns (evidence: `GunService.java`)
- Gun and ammo catalog → Gun inventory: reads inventory (evidence: `GunService.java`)
- Gun and ammo catalog → Ammo inventory: reads ammo (evidence: `GunService.java`)
- Booking and billing → Customer record: uses account (evidence: `BookingService.java`)
- Booking and billing → Booking record: parses bookings (evidence: `BookingService.java`)
- Booking and billing → Gun and ammo catalog: loads catalog (evidence: `BookingService.java`)
- Booking and billing → Bookings: reads and appends (evidence: `BookingService.java`)
- Admin menu → Bookings: reads bookings (evidence: `AdminPanel.java`)
- Admin menu → Confirmed bookings: appends confirmations (evidence: `AdminPanel.java`)
- Admin menu → Gun inventory: appends guns (evidence: `AdminPanel.java`)
- Admin menu → Ammo inventory: appends ammo (evidence: `AdminPanel.java`)
