# Constitución del Proyecto (gemini.md) ## 1. Esquemas de Datos (Data Schemas) > **Mandatorio**: Definir JSON Input/Output antes de la fase de Arquitectura. ## 1. Esquemas de Datos (Data Schemas) > **Mandatorio**: Definir JSON Input/Output antes de la fase de Arquitectura. ### Database Schema (Supabase) Table: `reservations` ```json { "id": "uuid (PK)", "created_at": "timestamptz", "start_date": "date (NOT NULL)", "end_date": "date (NOT NULL)", "client_name": "text (NOT NULL)", "origin": "text (NOT NULL) ENUM('Teneriffa2000', 'Naturcalabacera')", "invoice_number": "text", "adults_count": "integer (DEFAULT 0)", "children_count": "integer (DEFAULT 0)", "has_cleaning": "boolean (DEFAULT false)", "has_pool_heating": "boolean (DEFAULT false)", "has_flies_products": "boolean (DEFAULT false)", "government_registration": "text" } ``` ### Webhook Payload (Output) Trigger: When `government_registration` changes from EMPTY/NULL to VALUE. ```json { "event": "registration_filled", "reservation_id": "uuid", "client_name": "text", "government_registration": "text", "invoice_number": "text", "start_date": "YYYY-MM-DD", "end_date": "YYYY-MM-DD" } ``` ## 2. Reglas de Comportamiento - **Prioridad**: Fiabilidad > Velocidad. - **UX**: Single Page Application (SPA). Modals para todo. No recargas. - **Source of Truth**: Supabase. No sync con iCal externo. - **Frontend Logic**: Cálculos en tiempo real (Total Personas, Total Días). - **Triggers**: Webhook solo dispara si `registro` cambia de vacío a lleno. ## 3. Invariantes Arquitectónicas - `tools/` solo contiene scripts atómicos. - `architecture/` contiene la lógica (SOPs). - `tú` (Gemini) eres el enrutador. - **Stack**: React (Vite), TailwindCSS, Supabase JS Client, React Big Calendar / FullCalendar.