# roy-heinrich/sw-assessment architecture

> Architecture diagram of the GitHub repository roy-heinrich/sw-assessment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/roy-heinrich/sw-assessment
- Repository: https://github.com/roy-heinrich/sw-assessment

## Overview

Southwest Tours is a PHP booking manifest for staff to manage passenger transfers: submit or edit bookings, search/filter and page through active or archived records, change status, and restore or permanently delete. The single HTTP entry point dispatches actions, validates input, calls the repository, and renders full-page or HTMX responses. Repository excerpts establish persistence and view relationships; the README documents the broader workflow and database setup. Some view and routing details are unsampled, so the graph omits unverified links.

Main entry points: [`index.php`](https://github.com/roy-heinrich/sw-assessment/blob/main/index.php) (Request dispatcher), [`src/Database.php`](https://github.com/roy-heinrich/sw-assessment/blob/main/src/Database.php) (Connection and schema), [`views/layout.php`](https://github.com/roy-heinrich/sw-assessment/blob/main/views/layout.php) (Manifest layout), [`views/table.php`](https://github.com/roy-heinrich/sw-assessment/blob/main/views/table.php) (Booking table)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Booking workflow"]
  node_entry["Request dispatcher<br/>[index.php]"]
end

subgraph group_domain["Booking domain"]
  node_validation["Booking validation<br/>[BookingInput.php]"]
  node_guestname["Guest name formatting<br/>[GuestName.php]"]
end

subgraph group_persistence["Persistence"]
  node_repository["Booking operations"]
  node_database["Connection and schema<br/>[Database.php]"]
  node_store[("Bookings database")]
end

subgraph group_presentation["Staff interface"]
  node_layout["Manifest layout<br/>[layout.php]"]
  node_form["Booking form<br/>[form_modal.php]"]
  node_confirm["Action confirmation<br/>[confirm_modal.php]"]
  node_table["Booking table<br/>[table.php]"]
  node_stats["Booking statistics<br/>[stats.php]"]
  node_flash["Notifications<br/>[flash.php]"]
end

node_staff(("Staff"))
node_postgres[("PostgreSQL")]
node_sqlite[("SQLite")]

node_staff -->|"submits requests"| node_entry
node_entry -->|"validates input"| node_validation
node_entry -->|"dispatches actions"| node_repository
node_entry -->|"renders form"| node_form
node_entry -->|"renders confirmation"| node_confirm
node_entry -->|"renders page"| node_layout
node_entry -->|"renders results"| node_table
node_entry -->|"renders counts"| node_stats
node_entry -->|"renders notices"| node_flash
node_repository -->|"gets connection"| node_database
node_database -->|"creates schema"| node_store
node_database -->|"connects when configured"| node_postgres
node_database -->|"uses local fallback"| node_sqlite
node_entry -->|"formats guest name"| node_guestname
node_table -->|"formats displayed names"| node_guestname
node_confirm -->|"formats guest name"| node_guestname
node_layout -->|"includes notifications"| node_flash
node_layout -->|"includes statistics"| node_stats
node_layout -->|"includes booking table"| node_table

click node_entry "https://github.com/roy-heinrich/sw-assessment/blob/main/index.php"
click node_validation "https://github.com/roy-heinrich/sw-assessment/blob/main/src/BookingInput.php"
click node_guestname "https://github.com/roy-heinrich/sw-assessment/blob/main/src/GuestName.php"
click node_repository "https://github.com/roy-heinrich/sw-assessment/blob/main/src/BookingRepository.php"
click node_database "https://github.com/roy-heinrich/sw-assessment/blob/main/src/Database.php"
click node_layout "https://github.com/roy-heinrich/sw-assessment/blob/main/views/layout.php"
click node_form "https://github.com/roy-heinrich/sw-assessment/blob/main/views/form_modal.php"
click node_confirm "https://github.com/roy-heinrich/sw-assessment/blob/main/views/confirm_modal.php"
click node_table "https://github.com/roy-heinrich/sw-assessment/blob/main/views/table.php"
click node_stats "https://github.com/roy-heinrich/sw-assessment/blob/main/views/stats.php"
click node_flash "https://github.com/roy-heinrich/sw-assessment/blob/main/views/flash.php"

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_entry toneBlue
class node_validation,node_guestname,node_postgres,node_sqlite toneAmber
class node_repository,node_database,node_store toneMint
class node_layout,node_form,node_confirm,node_table,node_stats,node_flash toneRose
class node_staff toneIndigo
```

## Components

### Booking workflow

- [Request dispatcher](https://github.com/roy-heinrich/sw-assessment/blob/main/index.php): `index.php`

### Booking domain

- [Booking validation](https://github.com/roy-heinrich/sw-assessment/blob/main/src/BookingInput.php): `src/BookingInput.php`
- [Guest name formatting](https://github.com/roy-heinrich/sw-assessment/blob/main/src/GuestName.php): `src/GuestName.php`

### Persistence

- [Booking operations](https://github.com/roy-heinrich/sw-assessment/blob/main/src/BookingRepository.php): `src/BookingRepository.php`
- [Connection and schema](https://github.com/roy-heinrich/sw-assessment/blob/main/src/Database.php): `src/Database.php`
- **Bookings database**

### Staff interface

- [Manifest layout](https://github.com/roy-heinrich/sw-assessment/blob/main/views/layout.php): `views/layout.php`
- [Booking form](https://github.com/roy-heinrich/sw-assessment/blob/main/views/form_modal.php): `views/form_modal.php`
- [Action confirmation](https://github.com/roy-heinrich/sw-assessment/blob/main/views/confirm_modal.php): `views/confirm_modal.php`
- [Booking table](https://github.com/roy-heinrich/sw-assessment/blob/main/views/table.php): `views/table.php`
- [Booking statistics](https://github.com/roy-heinrich/sw-assessment/blob/main/views/stats.php): `views/stats.php`
- [Notifications](https://github.com/roy-heinrich/sw-assessment/blob/main/views/flash.php): `views/flash.php`

### Other components

- **Staff**
- **PostgreSQL**
- **SQLite**

## Connections

- Staff → Request dispatcher: submits requests (evidence: `README.md`)
- Request dispatcher → Booking validation: validates input (evidence: `index.php`)
- Request dispatcher → Booking operations: dispatches actions (evidence: `index.php`)
- Request dispatcher → Booking form: renders form (evidence: `index.php`)
- Request dispatcher → Action confirmation: renders confirmation (evidence: `index.php`)
- Request dispatcher → Manifest layout: renders page (evidence: `index.php`)
- Request dispatcher → Booking table: renders results (evidence: `index.php`)
- Request dispatcher → Booking statistics: renders counts (evidence: `index.php`)
- Request dispatcher → Notifications: renders notices (evidence: `index.php`)
- Booking operations → Connection and schema: gets connection (evidence: `src/BookingRepository.php`)
- Connection and schema → Bookings database: creates schema (evidence: `src/Database.php`)
- Connection and schema → PostgreSQL: connects when configured (evidence: `src/Database.php`)
- Connection and schema → SQLite: uses local fallback (evidence: `README.md`)
- Request dispatcher → Guest name formatting: formats guest name (evidence: `index.php`)
- Booking table → Guest name formatting: formats displayed names (evidence: `views/table.php`)
- Action confirmation → Guest name formatting: formats guest name (evidence: `views/confirm_modal.php`)
- Manifest layout → Notifications: includes notifications (evidence: `views/layout.php`)
- Manifest layout → Booking statistics: includes statistics (evidence: `views/layout.php`)
- Manifest layout → Booking table: includes booking table (evidence: `views/layout.php`)
