# hithami/sistemacoworking architecture

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

- Interactive diagram: https://gitdiagram.com/hithami/sistemacoworking
- Repository: https://github.com/hithami/sistemacoworking

## Overview

CoworkingTeste is a Windows Forms application for managing coworking rooms and their bookings. Users enter through the menu, then manage rooms or create and remove bookings; the forms call repositories that read and write PostgreSQL data, which is also shown as a room name in booking listings. The README documents database-enforced validation, overlap prevention, protected deletion of rooms with future bookings, and operation logging. Source excerpts establish the form-to-repository and repository-to-connection behavior; menu navigation and SQL implementation details are not sampled, so those links are marked unverified or documented rather than inferred from code.

Main entry points: [`CoworkingTeste/Forms/FormAgendamento/FormAgendamento.cs`](https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Forms/FormAgendamento/FormAgendamento.cs) (Booking management), [`CoworkingTeste/Repositories/SalaRepository.cs`](https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Repositories/SalaRepository.cs) (Room repository), [`CoworkingTeste/Repositories/AgendamentoRepository.cs`](https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Repositories/AgendamentoRepository.cs) (Booking repository), [`CoworkingTeste/Forms/FormMenu/FormMenu.cs`](https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Forms/FormMenu/FormMenu.cs) (Main menu)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_program["Application entry<br/>[Program.cs]"]
  node_menu["Main menu<br/>[FormMenu.cs]"]
  node_roomform["Room management<br/>[FormSala.cs]"]
  node_bookingform["Booking management<br/>[FormAgendamento.cs]"]
end

subgraph group_domain["Domain models"]
  node_room["Room model<br/>[Sala.cs]"]
  node_booking["Booking model<br/>[Agendamento.cs]"]
end

subgraph group_data["Data access"]
  node_roomrepo["Room repository<br/>[SalaRepository.cs]"]
  node_bookingrepo["Booking repository"]
  node_connection["Connection factory<br/>[Conexao.cs]"]
end

subgraph group_database["Database rules"]
  node_dbschema[("Schema and triggers<br/>[banco.sql]")]
end

node_user(("Coworking user"))
node_pg[("PostgreSQL database")]

node_user -->|"uses"| node_menu
node_program -->|"starts"| node_menu
node_menu -.->|"opens"| node_roomform
node_menu -.->|"opens"| node_bookingform
node_roomform -->|"calls"| node_roomrepo
node_roomform -->|"displays"| node_room
node_bookingform -->|"loads rooms"| node_roomrepo
node_bookingform -->|"manages bookings"| node_bookingrepo
node_bookingform -->|"displays"| node_room
node_bookingform -->|"displays"| node_booking
node_roomrepo -->|"maps rows"| node_room
node_bookingrepo -->|"maps rows"| node_booking
node_roomrepo -->|"creates connection"| node_connection
node_bookingrepo -->|"creates connection"| node_connection
node_connection -->|"connects"| node_pg
node_roomrepo -->|"reads and writes"| node_pg
node_bookingrepo -->|"reads and writes"| node_pg
node_dbschema -->|"defines rules"| node_pg

click node_program "https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Program.cs"
click node_menu "https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Forms/FormMenu/FormMenu.cs"
click node_roomform "https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Forms/FormSala/FormSala.cs"
click node_bookingform "https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Forms/FormAgendamento/FormAgendamento.cs"
click node_room "https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Models/Sala.cs"
click node_booking "https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Models/Agendamento.cs"
click node_roomrepo "https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Repositories/SalaRepository.cs"
click node_bookingrepo "https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Repositories/AgendamentoRepository.cs"
click node_connection "https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Conexao.cs"
click node_dbschema "https://github.com/hithami/sistemacoworking/blob/main/banco.sql"

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_program,node_menu,node_roomform,node_bookingform,node_user toneBlue
class node_room,node_booking,node_pg toneAmber
class node_roomrepo,node_bookingrepo,node_connection toneMint
class node_dbschema toneRose
```

## Components

### Desktop interface

- [Application entry](https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Program.cs): `CoworkingTeste/Program.cs`
- [Main menu](https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Forms/FormMenu/FormMenu.cs): `CoworkingTeste/Forms/FormMenu/FormMenu.cs`
- [Room management](https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Forms/FormSala/FormSala.cs): `CoworkingTeste/Forms/FormSala/FormSala.cs`
- [Booking management](https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Forms/FormAgendamento/FormAgendamento.cs): `CoworkingTeste/Forms/FormAgendamento/FormAgendamento.cs`

### Domain models

- [Room model](https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Models/Sala.cs): `CoworkingTeste/Models/Sala.cs`
- [Booking model](https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Models/Agendamento.cs): `CoworkingTeste/Models/Agendamento.cs`

### Data access

- [Room repository](https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Repositories/SalaRepository.cs): `CoworkingTeste/Repositories/SalaRepository.cs`
- [Booking repository](https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Repositories/AgendamentoRepository.cs): `CoworkingTeste/Repositories/AgendamentoRepository.cs`
- [Connection factory](https://github.com/hithami/sistemacoworking/blob/main/CoworkingTeste/Conexao.cs): `CoworkingTeste/Conexao.cs`

### Database rules

- [Schema and triggers](https://github.com/hithami/sistemacoworking/blob/main/banco.sql): `banco.sql`

### Other components

- **Coworking user**
- **PostgreSQL database**

## Connections

- Coworking user → Main menu: uses (evidence: `README.md`)
- Application entry → Main menu: starts (evidence: `CoworkingTeste/Program.cs`)
- Main menu → Room management: opens
- Main menu → Booking management: opens
- Room management → Room repository: calls (evidence: `CoworkingTeste/Forms/FormSala/FormSala.cs`)
- Room management → Room model: displays (evidence: `CoworkingTeste/Forms/FormSala/FormSala.cs`)
- Booking management → Room repository: loads rooms (evidence: `CoworkingTeste/Forms/FormAgendamento/FormAgendamento.cs`)
- Booking management → Booking repository: manages bookings (evidence: `CoworkingTeste/Forms/FormAgendamento/FormAgendamento.cs`)
- Booking management → Room model: displays (evidence: `CoworkingTeste/Forms/FormAgendamento/FormAgendamento.cs`)
- Booking management → Booking model: displays (evidence: `CoworkingTeste/Forms/FormAgendamento/FormAgendamento.cs`)
- Room repository → Room model: maps rows (evidence: `CoworkingTeste/Repositories/SalaRepository.cs`)
- Booking repository → Booking model: maps rows (evidence: `CoworkingTeste/Repositories/AgendamentoRepository.cs`)
- Room repository → Connection factory: creates connection (evidence: `CoworkingTeste/Repositories/SalaRepository.cs`)
- Booking repository → Connection factory: creates connection (evidence: `CoworkingTeste/Repositories/AgendamentoRepository.cs`)
- Connection factory → PostgreSQL database: connects (evidence: `README.md`)
- Room repository → PostgreSQL database: reads and writes (evidence: `CoworkingTeste/Repositories/SalaRepository.cs`)
- Booking repository → PostgreSQL database: reads and writes (evidence: `CoworkingTeste/Repositories/AgendamentoRepository.cs`)
- Schema and triggers → PostgreSQL database: defines rules (evidence: `README.md`)
