# yaiza22/gestor-reservas-hotel architecture

> Architecture diagram of the GitHub repository yaiza22/gestor-reservas-hotel, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yaiza22/gestor-reservas-hotel
- Repository: https://github.com/yaiza22/gestor-reservas-hotel

## Overview

#### Purpose and Entry Point
This is a desktop hotel-reservation management application, organized around users, rooms, and reservations. The runtime starts at `src/Main.java`, which is expected to initialize the main Swing UI in `src/view/VentanaPrincipal.java`.

#### Presentation Layer
The application exposes separate UI areas for each main domain:
- `src/view/VentanaPrincipal.java` is the desktop shell and navigation boundary.
- `src/view/PanelHabitaciones.java` manages room-facing interactions.
- `src/view/PanelReservas.java` and `src/view/PanelUsuarios.java` support reservation and user workflows.

Views should delegate actions rather than own business or persistence logic.

#### Controllers
Controllers mediate UI requests and the domain/service layer:
- `src/controller/HabitacionController.java`
- `src/controller/ReservaController.java`
- `src/controller/UsuarioController.java`

Each controller corresponds to one primary aggregate and is the likely boundary for validation, CRUD orchestration, and UI-friendly results.

#### Reservation Facade
`src/model/facade/IReservasFacade.java` defines the reservation-oriented application API, while `src/model/facade/ReservasFacade.java` coordinates domain operations and DAO access. This is the main business-service boundary, especially where reservation creation or changes must account for room status, user identity, and reservation state.

#### Domain Model
Core business entities are under `src/model/entidades/`:
- `src/model/entidades/Usuario.java` is the user base type; `Cliente.java` and `Empleado.java` specialize it.
- `src/model/entidades/Habitacion.java` represents hotel inventory.
- `src/model/entidades/Reserva.java` connects a reservation to relevant user and room data.

State and classification are modeled explicitly through enums such as `src/model/enums/EstadoHabitacion.java`, `src/model/enums/EstadoReserva.java`, and `src/model/enums/Rol.java`.

#### Persistence Boundary
DAO interfaces isolate storage operations:
- `src/model/dao/HabitacionDAO.java`
- `src/model/dao/ReservaDAO.java`
- `src/model/dao/UsuarioDAO.java`

The available implementations, `HabitacionDAOMemoria.java`, `ReservaDAOMemoria.java`, and `UsuarioDAOMemoria.java`, indicate in-memory persistence. There is no database, network service, or external infrastructure represented in this repository; application state is therefore process-local unless another implementation is introduced.

#### Creation and Primary Flow
`src/model/factory/UsuarioFactory.java` centralizes construction of user variants, likely selecting client versus employee behavior from role/type input.

The principal control flow is: `Main` starts `VentanaPrincipal`; panels invoke their matching controllers; controllers call `ReservasFacade` and/or DAO contracts; the facade applies cross-entity reservation rules; DAOs read or mutate in-memory entity collections; updated entities and states return to the UI for display.

Main entry points: [`src/model/facade/ReservasFacade.java`](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/facade/ReservasFacade.java) (Reservations facade), [`src/view/VentanaPrincipal.java`](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/view/VentanaPrincipal.java) (Ventana Principal), [`src/model/dao/HabitacionDAOMemoria.java`](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/dao/HabitacionDAOMemoria.java) (Memory DAO implementations), [`src/controller/UsuarioController.java`](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/controller/UsuarioController.java) (User controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Swing presentation"]
  node_shell["Ventana Principal<br/>Swing shell"]
  node_room_panel["Room panel<br/>Swing view"]
  node_reservation_panel["Reservation panel<br/>Swing view<br/>[PanelReservas.java]"]
  node_user_panel["User panel<br/>Swing view<br/>[PanelUsuarios.java]"]
end

subgraph group_application["Application layer"]
  node_room_controller["Room controller"]
  node_reservation_controller["Reservation controller"]
  node_user_controller["User controller"]
  node_reservation_api["Reservation API<br/>facade interface"]
  node_reservation_facade{{"Reservations facade<br/>application service"}}
end

subgraph group_domain["Domain model"]
  node_user_factory["User factory"]
  node_entities["Hotel entities<br/>domain entities<br/>[Reserva.java]"]
  node_states["States and roles<br/>domain enums<br/>[EstadoReserva.java]"]
end

subgraph group_persistence["In-memory persistence"]
  node_room_dao["Room DAO<br/>DAO contract<br/>[HabitacionDAO.java]"]
  node_reservation_dao["Reservation DAO<br/>DAO contract<br/>[ReservaDAO.java]"]
  node_user_dao["User DAO<br/>DAO contract<br/>[UsuarioDAO.java]"]
  node_memory_store[("Memory DAO implementations<br/>process-local storage")]
end

node_main(("Main<br/>desktop entry point<br/>[Main.java]"))

node_main -->|"starts"| node_shell
node_shell -->|"hosts"| node_room_panel
node_shell -->|"hosts"| node_reservation_panel
node_shell -->|"hosts"| node_user_panel
node_room_panel -->|"actions"| node_room_controller
node_reservation_panel -->|"actions"| node_reservation_controller
node_user_panel -->|"actions"| node_user_controller
node_room_controller -->|"coordinates"| node_reservation_facade
node_reservation_controller -->|"uses"| node_reservation_api
node_user_controller -->|"coordinates"| node_reservation_facade
node_reservation_api -->|"implemented by"| node_reservation_facade
node_reservation_facade -->|"enforces rules on"| node_entities
node_reservation_facade -->|"evaluates"| node_states
node_reservation_facade -->|"accesses"| node_room_dao
node_reservation_facade -->|"accesses"| node_reservation_dao
node_reservation_facade -->|"accesses"| node_user_dao
node_user_controller -->|"creates users"| node_user_factory
node_user_factory -->|"constructs"| node_entities
node_room_dao -->|"implemented in"| node_memory_store
node_reservation_dao -->|"implemented in"| node_memory_store
node_user_dao -->|"implemented in"| node_memory_store
node_memory_store -->|"stores"| node_entities

click node_main "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/Main.java"
click node_shell "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/view/VentanaPrincipal.java"
click node_room_panel "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/view/PanelHabitaciones.java"
click node_reservation_panel "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/view/PanelReservas.java"
click node_user_panel "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/view/PanelUsuarios.java"
click node_room_controller "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/controller/HabitacionController.java"
click node_reservation_controller "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/controller/ReservaController.java"
click node_user_controller "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/controller/UsuarioController.java"
click node_reservation_api "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/facade/IReservasFacade.java"
click node_reservation_facade "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/facade/ReservasFacade.java"
click node_user_factory "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/factory/UsuarioFactory.java"
click node_entities "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/entidades/Reserva.java"
click node_states "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/enums/EstadoReserva.java"
click node_room_dao "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/dao/HabitacionDAO.java"
click node_reservation_dao "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/dao/ReservaDAO.java"
click node_user_dao "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/dao/UsuarioDAO.java"
click node_memory_store "https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/dao/HabitacionDAOMemoria.java"

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_shell,node_room_panel,node_reservation_panel,node_user_panel toneBlue
class node_room_controller,node_reservation_controller,node_user_controller,node_reservation_api,node_reservation_facade toneAmber
class node_user_factory,node_entities,node_states toneMint
class node_room_dao,node_reservation_dao,node_user_dao,node_memory_store toneRose
class node_main toneNeutral
```

## Components

### Swing presentation

- [Ventana Principal](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/view/VentanaPrincipal.java): Swing shell · Navigation boundary for domain panels. · `src/view/VentanaPrincipal.java`
- [Room panel](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/view/PanelHabitaciones.java): Swing view · `src/view/PanelHabitaciones.java`
- [Reservation panel](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/view/PanelReservas.java): Swing view · `src/view/PanelReservas.java`
- [User panel](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/view/PanelUsuarios.java): Swing view · `src/view/PanelUsuarios.java`

### Application layer

- [Room controller](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/controller/HabitacionController.java): controller · `src/controller/HabitacionController.java`
- [Reservation controller](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/controller/ReservaController.java): controller · `src/controller/ReservaController.java`
- [User controller](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/controller/UsuarioController.java): controller · `src/controller/UsuarioController.java`
- [Reservation API](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/facade/IReservasFacade.java): facade interface · `src/model/facade/IReservasFacade.java`
- [Reservations facade](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/facade/ReservasFacade.java): application service · Applies cross-entity reservation rules. · `src/model/facade/ReservasFacade.java`

### Domain model

- [User factory](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/factory/UsuarioFactory.java): factory · Constructs client or employee variants. · `src/model/factory/UsuarioFactory.java`
- [Hotel entities](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/entidades/Reserva.java): domain entities · Usuario, Cliente, Empleado, Habitacion, and Reserva. · `src/model/entidades/Reserva.java`
- [States and roles](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/enums/EstadoReserva.java): domain enums · Room and reservation states plus user roles. · `src/model/enums/EstadoReserva.java`

### In-memory persistence

- [Room DAO](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/dao/HabitacionDAO.java): DAO contract · `src/model/dao/HabitacionDAO.java`
- [Reservation DAO](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/dao/ReservaDAO.java): DAO contract · `src/model/dao/ReservaDAO.java`
- [User DAO](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/dao/UsuarioDAO.java): DAO contract · `src/model/dao/UsuarioDAO.java`
- [Memory DAO implementations](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/model/dao/HabitacionDAOMemoria.java): process-local storage · In-memory room, reservation, and user collections. · `src/model/dao/HabitacionDAOMemoria.java`

### Other components

- [Main](https://github.com/yaiza22/gestor-reservas-hotel/blob/main/src/Main.java): desktop entry point · `src/Main.java`

## Connections

- Main → Ventana Principal: starts
- Ventana Principal → Room panel: hosts
- Ventana Principal → Reservation panel: hosts
- Ventana Principal → User panel: hosts
- Room panel → Room controller: actions
- Reservation panel → Reservation controller: actions
- User panel → User controller: actions
- Room controller → Reservations facade: coordinates
- Reservation controller → Reservation API: uses
- User controller → Reservations facade: coordinates
- Reservation API → Reservations facade: implemented by
- Reservations facade → Hotel entities: enforces rules on
- Reservations facade → States and roles: evaluates
- Reservations facade → Room DAO: accesses
- Reservations facade → Reservation DAO: accesses
- Reservations facade → User DAO: accesses
- User controller → User factory: creates users
- User factory → Hotel entities: constructs
- Room DAO → Memory DAO implementations: implemented in
- Reservation DAO → Memory DAO implementations: implemented in
- User DAO → Memory DAO implementations: implemented in
- Memory DAO implementations → Hotel entities: stores
