# Architecture

Zavvion Events uses a layered Yii 3-oriented MVC architecture.

## Layers

- Domain: focused value objects and services for money, fees, taxes, checkout breakdowns, seat holds, QR tokens, scanner validation, and permissions.
- Application: workflow services such as checkout creation, payment confirmation, organiser approval, attendee import, privacy requests, and reporting.
- Infrastructure: MySQL repositories, Stripe adapter, email/SMS/wallet/PDF delivery adapters, uploads, logging, and webhook persistence.
- Interface: Bootstrap 5 web controllers, REST API controllers under `/api/v1`, scanner views, organiser/admin/customer pages, and error pages.

## Object Model

- `User` can have many configurable roles through `user_roles`.
- `Role` grants configurable `Permission` records through `role_permissions`.
- `Organiser` owns events, venues, staff, products, promo codes, Stripe connected account records, orders, and reports.
- `Event` owns ticket types, event seat inventory, orders, tickets, donations, products, scan logs, and attendee imports.
- `VenueSeatMap` defines reusable seats; `EventSeat` represents event-specific availability.
- `Order` stores every accounting component separately.
- `Ticket` is issued only after trusted payment confirmation.
- `TicketQrToken` stores a hash of an unguessable signed token.
- `PaymentGatewayInterface` isolates Stripe from checkout workflows.

## Boundaries

Controllers must not calculate fee/tax totals, mutate seat states directly, or trust browser redirects for payment completion. They call services, and services use transactions for seat holds, checkout conversion, and ticket issuing.
