<?php

namespace App\Support\Api\V1;

class SerenataApiDocumentation
{
    public static function openApi(string $baseUrl): array
    {
        return [
            'openapi' => '3.1.0',
            'info' => [
                'title' => 'Mariachis Serenatas API',
                'version' => '1.0.0',
                'description' => 'API autenticada para consultar catálogo, crear serenatas y consultar serenatas existentes.',
            ],
            'servers' => [
                ['url' => $baseUrl],
            ],
            'x-agent-entrypoint' => [
                'purpose' => 'Usa este documento como contrato fuente para integrarte con la API.',
                'documentation_url' => $baseUrl.'/api/v1/docs?api_token=<TOKEN_API>',
                'openapi_url' => $baseUrl.'/api/v1/openapi.json?api_token=<TOKEN_API>',
                'auth_for_docs' => [
                    'supported' => ['Authorization: Bearer <TOKEN_API>', '?api_token=<TOKEN_API>'],
                    'recommended' => 'Authorization: Bearer <TOKEN_API>',
                    'warning' => 'El query param api_token existe solo para facilitar lectura automática de la documentación.',
                ],
                'auth_for_api_calls' => [
                    'required_header' => 'Authorization: Bearer <TOKEN_API>',
                    'content_type' => 'application/json',
                ],
                'recommended_workflow' => [
                    '1. Lee GET /api/v1/catalog para descubrir ids y opciones válidas.',
                    '2. Usa GET /api/v1/serenatas con filtros para buscar por teléfono, email, código o referencia.',
                    '3. Usa POST /api/v1/serenatas con external_reference, submission_token o Idempotency-Key.',
                    '4. Consulta GET /api/v1/serenatas/{reference} usando id, code o external_reference.',
                ],
            ],
            'security' => [
                ['bearerAuth' => []],
            ],
            'paths' => [
                '/api/v1/me' => [
                    'get' => [
                        'summary' => 'Usuario autenticado',
                        'description' => 'Devuelve los datos básicos del usuario asociado al token.',
                        'responses' => [
                            '200' => [
                                'description' => 'Usuario autenticado.',
                                'content' => [
                                    'application/json' => [
                                        'schema' => [
                                            'type' => 'object',
                                            'required' => ['user'],
                                            'properties' => [
                                                'user' => ['$ref' => '#/components/schemas/ApiUser'],
                                            ],
                                        ],
                                    ],
                                ],
                            ],
                            '401' => ['$ref' => '#/components/responses/Unauthorized'],
                        ],
                    ],
                ],
                '/api/v1/catalog' => [
                    'get' => [
                        'summary' => 'Catálogo para crear serenatas',
                        'description' => 'Devuelve grupos, métodos de pago, paquetes y opciones de costos válidas para el usuario y la fecha consultada.',
                        'parameters' => [
                            [
                                'name' => 'event_date',
                                'in' => 'query',
                                'required' => false,
                                'schema' => [
                                    'type' => 'string',
                                    'format' => 'date',
                                ],
                                'description' => 'Fecha del evento en formato YYYY-MM-DD.',
                            ],
                            [
                                'name' => 'mariachi_group_id',
                                'in' => 'query',
                                'required' => false,
                                'schema' => [
                                    'type' => 'integer',
                                    'minimum' => 1,
                                ],
                                'description' => 'Filtra opciones para un grupo musical específico.',
                            ],
                        ],
                        'responses' => [
                            '200' => [
                                'description' => 'Catálogo resuelto.',
                                'content' => [
                                    'application/json' => [
                                        'schema' => [
                                            'type' => 'object',
                                            'required' => ['catalog'],
                                            'properties' => [
                                                'catalog' => ['$ref' => '#/components/schemas/CatalogResponse'],
                                            ],
                                        ],
                                    ],
                                ],
                            ],
                            '401' => ['$ref' => '#/components/responses/Unauthorized'],
                            '403' => ['$ref' => '#/components/responses/Forbidden'],
                            '422' => ['$ref' => '#/components/responses/ValidationError'],
                        ],
                    ],
                ],
                '/api/v1/serenatas' => [
                    'get' => [
                        'summary' => 'Buscar serenatas',
                        'description' => 'Busca serenatas dentro del alcance del token. Debes enviar al menos uno de estos filtros: `phone`, `email`, `external_reference`, `code`, `event_date`.',
                        'parameters' => [
                            [
                                'name' => 'phone',
                                'in' => 'query',
                                'required' => false,
                                'schema' => [
                                    'type' => 'string',
                                    'maxLength' => 40,
                                ],
                                'description' => 'Busca contra `contact_phone_1` y `contact_phone_2` con normalización de número.',
                            ],
                            [
                                'name' => 'email',
                                'in' => 'query',
                                'required' => false,
                                'schema' => [
                                    'type' => 'string',
                                    'format' => 'email',
                                    'maxLength' => 255,
                                ],
                                'description' => 'Busca por `payer_email`.',
                            ],
                            [
                                'name' => 'external_reference',
                                'in' => 'query',
                                'required' => false,
                                'schema' => [
                                    'type' => 'string',
                                    'maxLength' => 120,
                                ],
                                'description' => 'Busca por referencia externa exacta.',
                            ],
                            [
                                'name' => 'code',
                                'in' => 'query',
                                'required' => false,
                                'schema' => [
                                    'type' => 'string',
                                    'maxLength' => 120,
                                ],
                                'description' => 'Busca por código interno exacto.',
                            ],
                            [
                                'name' => 'event_date',
                                'in' => 'query',
                                'required' => false,
                                'schema' => [
                                    'type' => 'string',
                                    'format' => 'date',
                                ],
                                'description' => 'Filtra por fecha exacta del evento.',
                            ],
                            [
                                'name' => 'limit',
                                'in' => 'query',
                                'required' => false,
                                'schema' => [
                                    'type' => 'integer',
                                    'minimum' => 1,
                                    'maximum' => 50,
                                    'default' => 10,
                                ],
                                'description' => 'Máximo de resultados a devolver.',
                            ],
                        ],
                        'responses' => [
                            '200' => [
                                'description' => 'Resultados de búsqueda.',
                                'content' => [
                                    'application/json' => [
                                        'schema' => ['$ref' => '#/components/schemas/SerenataSearchResponse'],
                                    ],
                                ],
                            ],
                            '401' => ['$ref' => '#/components/responses/Unauthorized'],
                            '403' => ['$ref' => '#/components/responses/Forbidden'],
                            '422' => ['$ref' => '#/components/responses/ValidationError'],
                        ],
                    ],
                    'post' => [
                        'summary' => 'Crear serenata',
                        'description' => 'Crea una serenata nueva. Si `external_reference` ya existe para el usuario, responde la serenata existente con `created=false`.',
                        'parameters' => [
                            [
                                'name' => 'Idempotency-Key',
                                'in' => 'header',
                                'required' => false,
                                'schema' => [
                                    'type' => 'string',
                                    'maxLength' => 120,
                                ],
                                'description' => 'Alternativa a `submission_token` para evitar duplicados por reintentos.',
                            ],
                        ],
                        'requestBody' => [
                            'required' => true,
                            'content' => [
                                'application/json' => [
                                    'schema' => ['$ref' => '#/components/schemas/SerenataCreateRequest'],
                                    'examples' => [
                                        'basic' => [
                                            'summary' => 'Creación mínima válida',
                                            'value' => [
                                                'external_reference' => 'cw-1001',
                                                'mariachi_group_id' => 1,
                                                'payer_name' => 'Laura Gomez',
                                                'payer_email' => 'laura@example.com',
                                                'service_address' => 'Calle 123 #45-67',
                                                'neighborhood' => 'Chapinero',
                                                'locality' => 'Bogotá',
                                                'contact_phone_1' => '3001234567',
                                                'reason' => 'Cumpleaños',
                                                'from_name' => 'Carlos',
                                                'to_name' => 'Mamá',
                                                'event_date' => '2026-06-01',
                                                'event_time' => '20:30',
                                                'payment_method' => 'Transferencia',
                                                'base_price' => 250000,
                                                'discount_amount' => 10000,
                                            ],
                                        ],
                                    ],
                                ],
                            ],
                        ],
                        'responses' => [
                            '201' => [
                                'description' => 'Serenata creada.',
                                'content' => [
                                    'application/json' => [
                                        'schema' => ['$ref' => '#/components/schemas/SerenataCreateResponse'],
                                    ],
                                ],
                            ],
                            '200' => [
                                'description' => 'Solicitud idempotente; devuelve una serenata ya existente.',
                                'content' => [
                                    'application/json' => [
                                        'schema' => ['$ref' => '#/components/schemas/SerenataCreateResponse'],
                                    ],
                                ],
                            ],
                            '401' => ['$ref' => '#/components/responses/Unauthorized'],
                            '403' => ['$ref' => '#/components/responses/Forbidden'],
                            '422' => ['$ref' => '#/components/responses/ValidationError'],
                        ],
                    ],
                ],
                '/api/v1/serenatas/{reference}' => [
                    'get' => [
                        'summary' => 'Consultar serenata',
                        'description' => 'Busca una serenata por `id`, `code` o `external_reference` dentro del alcance del token.',
                        'parameters' => [
                            [
                                'name' => 'reference',
                                'in' => 'path',
                                'required' => true,
                                'schema' => [
                                    'type' => 'string',
                                ],
                                'description' => 'ID numérico, código interno o referencia externa.',
                            ],
                        ],
                        'responses' => [
                            '200' => [
                                'description' => 'Serenata encontrada.',
                                'content' => [
                                    'application/json' => [
                                        'schema' => [
                                            'type' => 'object',
                                            'required' => ['serenata'],
                                            'properties' => [
                                                'serenata' => ['$ref' => '#/components/schemas/Serenata'],
                                            ],
                                        ],
                                    ],
                                ],
                            ],
                            '401' => ['$ref' => '#/components/responses/Unauthorized'],
                            '403' => ['$ref' => '#/components/responses/Forbidden'],
                            '404' => ['$ref' => '#/components/responses/NotFound'],
                        ],
                    ],
                ],
            ],
            'components' => [
                'securitySchemes' => [
                    'bearerAuth' => [
                        'type' => 'http',
                        'scheme' => 'bearer',
                        'bearerFormat' => 'API Token',
                        'description' => 'Usa el token emitido por el panel o por el comando `php artisan api-token:issue`.',
                    ],
                ],
                'responses' => [
                    'Unauthorized' => [
                        'description' => 'Token inválido o ausente.',
                        'content' => [
                            'application/json' => [
                                'schema' => ['$ref' => '#/components/schemas/MessageResponse'],
                                'example' => ['message' => 'Token API inválido.'],
                            ],
                        ],
                    ],
                    'Forbidden' => [
                        'description' => 'El usuario del token no tiene permisos suficientes.',
                        'content' => [
                            'application/json' => [
                                'schema' => ['$ref' => '#/components/schemas/MessageResponse'],
                                'example' => ['message' => 'This action is unauthorized.'],
                            ],
                        ],
                    ],
                    'NotFound' => [
                        'description' => 'Recurso no encontrado.',
                        'content' => [
                            'application/json' => [
                                'schema' => ['$ref' => '#/components/schemas/MessageResponse'],
                                'example' => ['message' => 'Not Found'],
                            ],
                        ],
                    ],
                    'ValidationError' => [
                        'description' => 'Error de validación.',
                        'content' => [
                            'application/json' => [
                                'schema' => ['$ref' => '#/components/schemas/ValidationError'],
                            ],
                        ],
                    ],
                ],
                'schemas' => [
                    'MessageResponse' => [
                        'type' => 'object',
                        'required' => ['message'],
                        'properties' => [
                            'message' => ['type' => 'string'],
                        ],
                    ],
                    'ValidationError' => [
                        'type' => 'object',
                        'required' => ['message', 'errors'],
                        'properties' => [
                            'message' => ['type' => 'string', 'example' => 'The given data was invalid.'],
                            'errors' => [
                                'type' => 'object',
                                'additionalProperties' => [
                                    'type' => 'array',
                                    'items' => ['type' => 'string'],
                                ],
                            ],
                        ],
                    ],
                    'ApiUser' => [
                        'type' => 'object',
                        'required' => ['id', 'name', 'email', 'role', 'organization_id'],
                        'properties' => [
                            'id' => ['type' => 'integer'],
                            'name' => ['type' => 'string'],
                            'email' => ['type' => 'string', 'format' => 'email'],
                            'role' => ['type' => 'string'],
                            'organization_id' => ['type' => 'integer'],
                        ],
                    ],
                    'GroupOption' => [
                        'type' => 'object',
                        'required' => ['id', 'name', 'is_default'],
                        'properties' => [
                            'id' => ['type' => 'integer'],
                            'name' => ['type' => 'string'],
                            'is_default' => ['type' => 'boolean'],
                        ],
                    ],
                    'PaymentMethodOption' => [
                        'type' => 'object',
                        'required' => ['id', 'name', 'is_default'],
                        'properties' => [
                            'id' => ['type' => 'integer'],
                            'name' => ['type' => 'string'],
                            'account_holder' => ['type' => ['string', 'null']],
                            'account_reference' => ['type' => ['string', 'null']],
                            'payment_details' => ['type' => ['string', 'null']],
                            'is_default' => ['type' => 'boolean'],
                        ],
                    ],
                    'PackageOption' => [
                        'type' => 'object',
                        'required' => ['id', 'name', 'mariachi_group_id', 'city', 'base_price', 'internal_cost', 'gift_codes', 'artist_codes', 'other_cost_codes', 'is_default'],
                        'properties' => [
                            'id' => ['type' => 'integer'],
                            'name' => ['type' => 'string'],
                            'mariachi_group_id' => ['type' => 'integer'],
                            'city' => ['type' => 'string'],
                            'base_price' => ['type' => 'number'],
                            'internal_cost' => ['type' => 'number'],
                            'gift_codes' => ['type' => 'array', 'items' => ['type' => 'string']],
                            'artist_codes' => ['type' => 'array', 'items' => ['type' => 'string']],
                            'other_cost_codes' => ['type' => 'array', 'items' => ['type' => 'string']],
                            'is_default' => ['type' => 'boolean'],
                        ],
                    ],
                    'CatalogOption' => [
                        'type' => 'object',
                        'required' => ['code', 'name', 'mariachi_group_id', 'price', 'internal_cost'],
                        'properties' => [
                            'code' => ['type' => 'string'],
                            'name' => ['type' => 'string'],
                            'mariachi_group_id' => ['type' => 'integer'],
                            'price' => ['type' => 'number'],
                            'internal_cost' => ['type' => 'number'],
                            'type' => ['type' => ['string', 'null']],
                            'is_default' => ['type' => ['boolean', 'null']],
                        ],
                    ],
                    'CatalogResponse' => [
                        'type' => 'object',
                        'required' => ['groups', 'payment_methods', 'packages', 'gift_options', 'artist_options', 'other_cost_options'],
                        'properties' => [
                            'groups' => [
                                'type' => 'array',
                                'items' => ['$ref' => '#/components/schemas/GroupOption'],
                            ],
                            'payment_methods' => [
                                'type' => 'array',
                                'items' => ['$ref' => '#/components/schemas/PaymentMethodOption'],
                            ],
                            'packages' => [
                                'type' => 'array',
                                'items' => ['$ref' => '#/components/schemas/PackageOption'],
                            ],
                            'gift_options' => [
                                'type' => 'array',
                                'items' => ['$ref' => '#/components/schemas/CatalogOption'],
                            ],
                            'artist_options' => [
                                'type' => 'array',
                                'items' => ['$ref' => '#/components/schemas/CatalogOption'],
                            ],
                            'other_cost_options' => [
                                'type' => 'array',
                                'items' => ['$ref' => '#/components/schemas/CatalogOption'],
                            ],
                        ],
                    ],
                    'CatalogItemSelection' => [
                        'type' => 'object',
                        'required' => ['code'],
                        'properties' => [
                            'code' => ['type' => 'string', 'maxLength' => 120],
                            'quantity' => ['type' => 'integer', 'minimum' => 1],
                            'unit_price' => ['type' => 'number', 'minimum' => 0],
                        ],
                    ],
                    'SerenataCreateRequest' => [
                        'type' => 'object',
                        'required' => [
                            'mariachi_group_id',
                            'payer_name',
                            'service_address',
                            'neighborhood',
                            'locality',
                            'contact_phone_1',
                            'reason',
                            'from_name',
                            'to_name',
                            'event_date',
                            'event_time',
                        ],
                        'properties' => [
                            'submission_token' => ['type' => ['string', 'null'], 'maxLength' => 120],
                            'external_reference' => ['type' => ['string', 'null'], 'maxLength' => 120],
                            'mariachi_group_id' => ['type' => 'integer', 'minimum' => 1],
                            'serenata_package_id' => ['type' => ['integer', 'null'], 'minimum' => 1],
                            'payer_name' => ['type' => 'string', 'maxLength' => 255],
                            'payer_email' => ['type' => ['string', 'null'], 'format' => 'email', 'maxLength' => 255],
                            'service_address' => ['type' => 'string', 'maxLength' => 255],
                            'address_additional' => ['type' => ['string', 'null'], 'maxLength' => 255],
                            'service_country' => ['type' => ['string', 'null'], 'maxLength' => 80, 'default' => 'Colombia'],
                            'service_department' => ['type' => ['string', 'null'], 'maxLength' => 120],
                            'neighborhood' => ['type' => 'string', 'maxLength' => 120],
                            'locality' => ['type' => 'string', 'maxLength' => 120],
                            'service_locality' => ['type' => ['string', 'null'], 'maxLength' => 120],
                            'service_sector' => ['type' => ['string', 'null'], 'maxLength' => 120],
                            'contact_phone_1' => ['type' => 'string', 'maxLength' => 40],
                            'contact_phone_2' => ['type' => ['string', 'null'], 'maxLength' => 40],
                            'reason' => ['type' => 'string', 'maxLength' => 255],
                            'from_name' => ['type' => 'string', 'maxLength' => 255],
                            'to_name' => ['type' => 'string', 'maxLength' => 255],
                            'event_date' => ['type' => 'string', 'format' => 'date'],
                            'event_time' => ['type' => 'string', 'pattern' => '^([01]\\d|2[0-3]):[0-5]\\d$'],
                            'internal_notes' => ['type' => ['string', 'null'], 'maxLength' => 1200],
                            'client_notes' => ['type' => ['string', 'null'], 'maxLength' => 1200],
                            'base_price' => ['type' => ['number', 'null'], 'minimum' => 0],
                            'gift_amount' => ['type' => ['number', 'null'], 'minimum' => 0],
                            'artist_amount' => ['type' => ['number', 'null'], 'minimum' => 0],
                            'other_cost_amount' => ['type' => ['number', 'null'], 'minimum' => 0],
                            'discount_amount' => ['type' => ['number', 'null'], 'minimum' => 0],
                            'commission_rate' => ['type' => ['number', 'null'], 'minimum' => 0, 'maximum' => 100],
                            'payment_method' => ['type' => ['string', 'null'], 'maxLength' => 120],
                            'service_status' => ['type' => ['string', 'null'], 'enum' => ['Pendiente', 'Confirmada', 'Realizada', 'Cancelada']],
                            'cancellation_reason' => ['type' => ['string', 'null'], 'maxLength' => 600],
                            'gift_items' => ['type' => ['array', 'null'], 'items' => ['$ref' => '#/components/schemas/CatalogItemSelection']],
                            'artist_items' => ['type' => ['array', 'null'], 'items' => ['$ref' => '#/components/schemas/CatalogItemSelection']],
                            'other_cost_items' => ['type' => ['array', 'null'], 'items' => ['$ref' => '#/components/schemas/CatalogItemSelection']],
                        ],
                        'description' => 'Debes enviar `submission_token`, `external_reference` o el header `Idempotency-Key` para evitar duplicados.',
                    ],
                    'SerenataPartyReference' => [
                        'type' => ['object', 'null'],
                        'properties' => [
                            'id' => ['type' => 'integer'],
                            'name' => ['type' => 'string'],
                        ],
                    ],
                    'SerenataCatalogLine' => [
                        'type' => 'object',
                        'required' => ['code', 'name', 'unit_price', 'quantity'],
                        'properties' => [
                            'code' => ['type' => 'string'],
                            'name' => ['type' => 'string'],
                            'unit_price' => ['type' => 'number'],
                            'quantity' => ['type' => 'integer'],
                            'total' => ['type' => 'number'],
                            'type' => ['type' => 'string'],
                        ],
                    ],
                    'Serenata' => [
                        'type' => 'object',
                        'required' => [
                            'id',
                            'code',
                            'organization_id',
                            'payer_name',
                            'contact_phone_1',
                            'service_address',
                            'service_country',
                            'neighborhood',
                            'locality',
                            'reason',
                            'from_name',
                            'to_name',
                            'event_date',
                            'event_time',
                            'payment_method',
                            'payment_status',
                            'service_status',
                            'base_price',
                            'gift_amount',
                            'artist_amount',
                            'other_cost_amount',
                            'discount_amount',
                            'base_cost',
                            'total_charged',
                            'profit_amount',
                            'commission_rate',
                            'commission_amount',
                            'gift_items',
                            'artist_items',
                            'other_cost_items',
                        ],
                        'properties' => [
                            'id' => ['type' => 'integer'],
                            'code' => ['type' => 'string'],
                            'external_reference' => ['type' => ['string', 'null']],
                            'organization_id' => ['type' => 'integer'],
                            'mariachi_group' => ['$ref' => '#/components/schemas/SerenataPartyReference'],
                            'package' => ['$ref' => '#/components/schemas/SerenataPartyReference'],
                            'customer' => ['$ref' => '#/components/schemas/SerenataPartyReference'],
                            'payer_name' => ['type' => 'string'],
                            'payer_email' => ['type' => ['string', 'null'], 'format' => 'email'],
                            'contact_phone_1' => ['type' => 'string'],
                            'contact_phone_2' => ['type' => ['string', 'null']],
                            'service_address' => ['type' => 'string'],
                            'address_additional' => ['type' => ['string', 'null']],
                            'service_country' => ['type' => 'string'],
                            'service_department' => ['type' => ['string', 'null']],
                            'neighborhood' => ['type' => 'string'],
                            'locality' => ['type' => 'string'],
                            'service_locality' => ['type' => ['string', 'null']],
                            'service_sector' => ['type' => ['string', 'null']],
                            'reason' => ['type' => 'string'],
                            'from_name' => ['type' => 'string'],
                            'to_name' => ['type' => 'string'],
                            'event_date' => ['type' => ['string', 'null'], 'format' => 'date'],
                            'event_time' => ['type' => 'string'],
                            'payment_method' => ['type' => 'string'],
                            'payment_status' => ['type' => 'string'],
                            'service_status' => ['type' => 'string'],
                            'base_price' => ['type' => 'number'],
                            'gift_amount' => ['type' => 'number'],
                            'artist_amount' => ['type' => 'number'],
                            'other_cost_amount' => ['type' => 'number'],
                            'discount_amount' => ['type' => 'number'],
                            'base_cost' => ['type' => 'number'],
                            'total_charged' => ['type' => 'number'],
                            'profit_amount' => ['type' => 'number'],
                            'commission_rate' => ['type' => 'number'],
                            'commission_amount' => ['type' => 'number'],
                            'gift_items' => ['type' => 'array', 'items' => ['$ref' => '#/components/schemas/SerenataCatalogLine']],
                            'artist_items' => ['type' => 'array', 'items' => ['$ref' => '#/components/schemas/SerenataCatalogLine']],
                            'other_cost_items' => ['type' => 'array', 'items' => ['$ref' => '#/components/schemas/SerenataCatalogLine']],
                            'internal_notes' => ['type' => ['string', 'null']],
                            'client_notes' => ['type' => ['string', 'null']],
                            'created_at' => ['type' => ['string', 'null'], 'format' => 'date-time'],
                            'updated_at' => ['type' => ['string', 'null'], 'format' => 'date-time'],
                        ],
                    ],
                    'SerenataCreateResponse' => [
                        'type' => 'object',
                        'required' => ['created', 'serenata'],
                        'properties' => [
                            'created' => ['type' => 'boolean'],
                            'serenata' => ['$ref' => '#/components/schemas/Serenata'],
                        ],
                    ],
                    'SerenataSummary' => [
                        'type' => 'object',
                        'required' => [
                            'id',
                            'code',
                            'payer_name',
                            'contact_phone_1',
                            'event_date',
                            'event_time',
                            'service_status',
                            'payment_status',
                            'payment_method',
                            'total_charged',
                        ],
                        'properties' => [
                            'id' => ['type' => 'integer'],
                            'code' => ['type' => 'string'],
                            'external_reference' => ['type' => ['string', 'null']],
                            'payer_name' => ['type' => 'string'],
                            'payer_email' => ['type' => ['string', 'null'], 'format' => 'email'],
                            'contact_phone_1' => ['type' => 'string'],
                            'contact_phone_2' => ['type' => ['string', 'null']],
                            'event_date' => ['type' => ['string', 'null'], 'format' => 'date'],
                            'event_time' => ['type' => 'string'],
                            'service_status' => ['type' => 'string'],
                            'payment_status' => ['type' => 'string'],
                            'payment_method' => ['type' => 'string'],
                            'total_charged' => ['type' => 'number'],
                            'mariachi_group' => ['$ref' => '#/components/schemas/SerenataPartyReference'],
                            'package' => ['$ref' => '#/components/schemas/SerenataPartyReference'],
                            'customer' => ['$ref' => '#/components/schemas/SerenataPartyReference'],
                        ],
                    ],
                    'SerenataSearchResponse' => [
                        'type' => 'object',
                        'required' => ['serenatas', 'meta'],
                        'properties' => [
                            'serenatas' => [
                                'type' => 'array',
                                'items' => ['$ref' => '#/components/schemas/SerenataSummary'],
                            ],
                            'meta' => [
                                'type' => 'object',
                                'required' => ['count', 'limit', 'filters'],
                                'properties' => [
                                    'count' => ['type' => 'integer'],
                                    'limit' => ['type' => 'integer'],
                                    'filters' => [
                                        'type' => 'object',
                                        'additionalProperties' => [
                                            'type' => 'string',
                                        ],
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ];
    }
}
